package com.ys.erp.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @author lwj
 * @date 2024/9/5
 */
public class RedisKey {

    @AllArgsConstructor
    @Getter
    public enum Enums {

        QUEUE_FINANCE_FLOW_IN("queue:finance_flow_in"),
        QUEUE_FINANCE_FLOW_OUT("queue:finance_flow_out"),

        WX_ACCESS_TOKEN("wx:access_token"),

        SHOP_SQB_MAP("shop_sqb_map"),
        SHOP_SQB("shop_sqb:"),

        DING_DING_TOKEN("ding:access_token"),

        EMP_LOGIN_FLAG("emp:login:"),
        EMP_APPLET_LOGIN_FLAG("emp:applet_login:"),
        EMP_LOGIN_ERROR("emp:login_error"),

        APPLET_SHOP_WARNING("shop:applet_shop_warning:"),

        /**
         * redis
         */
        ALL_RIGHT_FLAG("right:all_right"),

        CONTROLLER_RESULT_CACHE("controller_cache:{0}"),

        DING_GET_TOKEN("dingding:access_token"),
        SHOP_DATA_SMS_CODE("shop:data:sms:code:"),

        WX_YS_ACCESS_TOKEN("wx_ys:access_token"),

        ACTIVITY_COUPONS("activity:coupons:"),
        IMPORT_GOODS_REFRESH("import:goods:refresh"),
        ACTIVITY_COUPONS_REFRESH("activity:coupons:refresh"),
        ACTIVITY_STATUS_REFRESH("activity:status:refresh"),

        WFB_NEED_SEPARATE_ACCOUNTS("wfb:need_separate_accounts:{0}"),
        SEPARATE_ACCOUNT_FAIL("zfb:separate_accounts_fail"),
        SEPARATE_ACCOUNTS_QUEUE("queue:wfb:separate_accounts"),
        SEPARATE_ACCOUNTS_OK_ING("zfb:separate_accounts_ok_ing"),
        USER_ADD_CAT("user:add_pet:{0}"),

        ACTIVITY_TURNTABLE_PRIZED_KEY("activity:turntable:prized:{0}");

        private final String key;
    }

    public static final Map<String, String> ENUM_MAP = new HashMap<>();

    static {
        ENUM_MAP.put(Enums.EMP_LOGIN_FLAG.getKey(), "员工登录redis前缀");
        ENUM_MAP.put(Enums.APPLET_SHOP_WARNING.getKey(), "员工登录redis前缀");
        ENUM_MAP.put(Enums.EMP_APPLET_LOGIN_FLAG.getKey(), "员工小程序登录redis前缀");
        ENUM_MAP.put(Enums.DING_GET_TOKEN.getKey(), "获取钉钉token");
        ENUM_MAP.put(Enums.ALL_RIGHT_FLAG.getKey(), "所有权限缓存");
        ENUM_MAP.put(Enums.SHOP_DATA_SMS_CODE.getKey(), "门店数据平台短信验证码");
        ENUM_MAP.put(Enums.WX_YS_ACCESS_TOKEN.getKey(), "幺社主体微信接口调用凭证");
        ENUM_MAP.put(Enums.CONTROLLER_RESULT_CACHE.getKey(), "接口数据缓存");
        ENUM_MAP.put(Enums.QUEUE_FINANCE_FLOW_IN.getKey(), "财务流水队列");
        ENUM_MAP.put(Enums.QUEUE_FINANCE_FLOW_OUT.getKey(), "财务流水队列");
        ENUM_MAP.put(Enums.SHOP_SQB_MAP.getKey(), "商铺收钱吧门店对应");
        ENUM_MAP.put(Enums.SHOP_SQB.getKey(), "商铺收钱吧sn");
        ENUM_MAP.put(Enums.DING_DING_TOKEN.getKey(), "钉钉接口调用凭证");
        ENUM_MAP.put(Enums.WX_ACCESS_TOKEN.getKey(), "微信接口调用凭证");
        ENUM_MAP.put(Enums.SEPARATE_ACCOUNTS_QUEUE.getKey(), "微分呗待分账队列");
        ENUM_MAP.put(Enums.SEPARATE_ACCOUNT_FAIL.getKey(), "分账失败信息");
        ENUM_MAP.put(Enums.SEPARATE_ACCOUNTS_OK_ING.getKey(), "分账确认中信息");

        ENUM_MAP.put(Enums.WFB_NEED_SEPARATE_ACCOUNTS.getKey(), "微分呗扣款成功需要分账账户");
        ENUM_MAP.put(Enums.USER_ADD_CAT.getKey(), "用户添加宠物锁");
    }

    public static boolean isContainsKey(String key) {
        return ENUM_MAP.containsKey(key);
    }

}
